<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>整数拆分</title>
</head>

<body>
  <script>
    var integerBreak = function (n) {
      const dp = [0, 0, 1, 2, 4, 6, 9];
      for (let i = 7; i <= n; i++) {
        dp[i] = dp[i - 3] * 3;
      }
      return dp[n];
    };
    console.log(integerBreak(2))
  </script>
</body>

</html>